#coding=utf-8
from url import url
from bottle import route, run, Bottle, request, static_file, template, response
from functools import wraps
from lib import session, http, logs
import os

def login_required(func):
	@wraps(func)
	def decorated_view(*args, **kwargs):
		print '123'
		return func(*args, **kwargs)
	return decorated_view

class a:
	@url.get('/:size/:filename#.+#')
	def index(size,filename):
		return size + filename
	#说明1
	@url.get("/")
	def login():
		sql = 'select id,productid,pname,vprice,oprice from tp_product_cart_list limit 1,30'
		results = request.db.executejson(sql)
		for f in results:
			yield f['pname'] + str(f['id'])
		a = request.GET.get('低');
		a = http.toGB2312(a)
		# return '登录1成功2';
		# yield '123'
		p = {}
		p['12'] = 'jidw'
		p['低'] = '我的'
		p['1'] = '我的'
		# yield http.get('http://127.0.0.1:7000', p)
		# session.pop('ant')
		# return template('hello')
	#说明2
	@url.route('/hello/:name')
	@login_required
	def index(name='World'):
		print name.decode('utf8')
		return '<b>He2llo %s!</b>' % name


from bottle import Route
def logout():
	from lib import http
	session.set('ant','negocat')
	return 'rt';

ro=Route(url,'/s','GET',logout)
# url.add_route(ro)